﻿using System;
using System.Text.RegularExpressions;
using HttpApiGateway.Interface;
using HttpService.Collect;

namespace HttpApiGateway.Service
{
    [RpcClient.Attr.ClassLifetimeAttr(RpcClient.Attr.ClassLifetimeType.单例)]
    internal class UrlRewriteService : IUrlRewriteService
    {
        public void Remove(string path)
        {
            UrlRewriteCollect.Remove(path);
        }
        public void Remove(Regex regex)
        {
            UrlRewriteCollect.Remove(regex);
        }
        public void Add(string path, string endPoint)
        {
            UrlRewriteCollect.Add(path, endPoint);
        }
        public void Add(Regex regex, string endPoint)
        {
            UrlRewriteCollect.Add(regex, endPoint);
        }
        public void Add(string path, Func<Uri, string> filter)
        {
            UrlRewriteCollect.Add(path, filter);
        }
        public void Add(Regex regex, Func<Uri, string> filter)
        {
            UrlRewriteCollect.Add(regex, filter);
        }
    }
}
